﻿@{
    Layout = null;
    ViewBag.Title = "Northwind Company - Shippers";
}

<h2>Shippers</h2>
<h3>Demonstration of inline editing</h3>

@(Html.Kendo().Grid<NorthwindSample.Data.Shipper>()
    .Name("shippersGrid")
    .ToolBar(toolbar => toolbar.Create().Text("Add Shipper"))
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Columns(columns =>
    {
        columns.Bound(m => m.CompanyName);
        columns.Bound(m => m.Phone).Width(150);
        columns.Command(cmd =>
        {
            cmd.Edit();
            cmd.Destroy();
        }).Width(200);
    })
    .DataSource(dataSource => dataSource.Ajax()
        .Model(model => model.Id(m => m.ShipperID))
        .Read(read => read.Action("GetShippers", "Shippers"))
        .Create(create => create.Action("CreateShipper", "Shippers"))
        .Update(update => update.Action("UpdateShipper", "Shippers"))
        .Destroy(destroy => destroy.Action("DestroyShipper", "Shippers"))
    )
    .Selectable()
)
